import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {environment} from '@env/environment';
// layout
import {LayoutDefaultComponent} from '../layout/default/default.component';
import {LayoutFullScreenComponent} from '../layout/fullscreen/fullscreen.component';
import {LayoutPassportComponent} from '../layout/passport/passport.component';
// dashboard pages
import {DashboardComponent} from './dashboard/dashboard.component';
// passport pages
import {UserLoginComponent} from './passport/login/login.component';
// single pages
import {CallbackComponent} from './callback/callback.component';
import {Exception403Component} from './exception/403.component';
import {Exception404Component} from './exception/404.component';
import {Exception500Component} from './exception/500.component';
import {SingleComponent} from './passport/single/single.component';

const routes: Routes = [
    {path: 'single/:id', component: SingleComponent},
    {
        path: '',
        component: LayoutDefaultComponent,
        children: [
            {path: '', redirectTo: 'index', pathMatch: 'full'},
            // {path: 'dashboard', component: DashboardComponent, data: {title: '首页'}},
            {path: 'index', component: DashboardComponent, data: {title: '首页'}},
            // 业务子模块
            // { path: 'widgets', loadChildren: './widgets/widgets.module#WidgetsModule' }
            {path: 'user', loadChildren: './user/user.module#UserModule', data: {title: '用户管理'}},
            {path: 'teacher', loadChildren: './teacher/teacher.module#TeacherModule', data: {title: '教师管理'}},
            {path: 'news', loadChildren: './news/news.module#NewsModule', data: {title: '新闻管理'}},
            {path: 'clues', loadChildren: './clues/clues.module#CluesModule', data: {title: '线索管理'}},
            {path: 'vedio', loadChildren: './video/video.module#VideoModule', data: {title: '视屏管理'}},
            {path: 'signup', loadChildren: './signup/signup.module#SignupModule', data: {title: '报名管理'}},
            {path: 'banner', loadChildren: './banner/banner.module#BannerModule', data: {title: '轮播图管理'}},
            {path: 'admin', loadChildren: './admin/admin.module#AdminModule', data: {title: '管理员列表'}},
            {path: 'jpush', loadChildren: './jpush/jpush.module#JpushModule', data: {title: '推送列表'}},
            {path: 'business', loadChildren: './business/business.module#BusinessModule', data: {title: '商务服务'}},
            {path: 'navigation', loadChildren: './navigation/navigation.module#NavigationModule', data: {title: '菜单列表'}},
            {path: 'resource', loadChildren: './resource/resource.module#ResourceModule', data: {title: '资源列表'}},
            {path: 'role', loadChildren: './role/role.module#RoleModule', data: {title: '角色列表'}},
        ]
    },
    // 全屏布局
    // {
    //     path: 'fullscreen',
    //     component: LayoutFullScreenComponent,
    //     children: [
    //     ]
    // },
    // passport
    {
        path: 'passport',
        component: LayoutPassportComponent,
        children: [
            {path: 'login', component: UserLoginComponent},
            // { path: 'register', component: UserRegisterComponent },
            // { path: 'register-result', component: UserRegisterResultComponent }
        ]
    },
    // 单页不包裹Layout
    {path: 'callback/:type', component: CallbackComponent},
    {path: '403', component: Exception403Component},
    {path: '404', component: Exception404Component},
    {path: '500', component: Exception500Component},

    {path: '**', redirectTo: 'dashboard'}
];

@NgModule({
    imports: [RouterModule.forRoot(routes, {useHash: environment.useHash})],
    exports: [RouterModule]
})
export class RouteRoutingModule {
}
